<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="css/adress.css" />
		
	
	</head>
	<body>
		
	
		
		<!-- 收获地址界面 -->
		<div class="adress-info">
			<div class="addAdress">
				<button class="add">新增地址</button>
			</div>
			<div class="adress-list">
				<div class="specific-adress">
					<ul>
						<li class="title">
							<span class="title_name">骆继磊</span>
							<span class="title_province">河南</span>
						</li>
						<li>
							<span class="adress_receive">收货人：</span>
							<span class="receive_name">骆继磊</span>
							
						</li>
						<li>
							<span class="adress_area">所在地区：</span>
							<span class="area_name">河南</span>
						</li>
						<li>
							<span class="adress_retail">地址：</span>
							<span class="retail_name">成华大道</span>
						</li>
						<li>
							<span class="adress_tel">手机：</span>
							<span class="tel_name">110</span>
						</li>
						
					</ul>
					
					<a href="#" class="adress-delete">删除</a>
					<span class="adno">10086</span>
				</div>
		
			</div>
		
		</div>
	
		
		
		
	</body>
	<script src="js/jquery-3.4.1.min.js"></script>
	<script src="js/vue.js"></script>
	
	<script src="js/ajaxfileupload.js"></script>
	<script>
	let uno=1;
	$(".add").click(function(){
		
		
	
		
		
		
		
	});
	
	function start(){
		        $.get("address", {op: "finds", uno:uno}, function (rs) {
		            $(".GoodsNumber").text(rs.count);
		            showAddress(rs.data);
		        }, "json");
		
	}
	function remove(obj){
		var adno=$(obj).closest(".specific-adress").find(".adno").text();
		$.get("address",{op:"delete",uno:uno,adno:adno},function(){
			
			if(rs>0){
					$(obj).closest(".specific-adress").remove();
			}else{
				alert("删除失败！");
			}
		
			
		}."json")
		
		
		
		
	}
	function showAddress(arr){
		
		let str = '';
		        for (let i = 0; i < arr.length; i++) {
		           
		
		            var province = arr[i].address;
		            if (province.indexOf("省") > 0) {
		                province = province.substr(0, gpics.indexOf("省"));
		             
		            }
		
		
		            str += '<div class="specific-adress"><ul><li class="title">' +
					'<span class="title_name">'+arr[i].consignee+'</span>' +
					'<span class="title_province">'+province+'</span></li><li>' +
					'<span class="adress_receive">收货人：</span>' +
					'<span class="receive_name">'+arr[i].consignee+'</span>' +
					'</li><li><span class="adress_area">所在地区：</span>' +
					'<span class="area_name">'+province+'</span></li>' +
					'<li><span class="adress_retail">地址：</span>' +
					'<span class="retail_name">'+arr[i].address+'</span></li>=<li>' +
					'<span class="adress_tel">手机：</span>' +
					'<span class="tel_name">'+arr[i].artel+'</span></li></ul>
					'<a href="#" class="adress-delete" onclick="remove(this)">删除</a>'+
					'<span class="adno">'+arr[i].adno+'</span></div></div>'
					

		        }
		        $(".adress-list").html(str);


	}
	
	start();
	
	</script>
	
	
</html>
